<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="security" %>

<LINK href="images/css.css" type="text/css" rel="stylesheet">
<style type="text/css">
<!--
.STYLE1 {
	font-size: 12px
}

.STYLE3 {
	color: #707070;
	font-size: 12px;
}

.STYLE5 {
	color: #0a6e0c;
	font-size: 12px;
}

body {
	margin-top: 0px;
	margin-bottom: 0px;
}

.STYLE7 {
	font-size: 12
}
-->
</style>
<script type="text/javascript">
	function checkForm() {
		var buildingId = document.getElementById("buildingId").value;
		var name = document.getElementById("name").value;
		var type = document.getElementById("typeId").value;
		var floorCount = document.getElementById("floorCount").value;
		var subDistrictId = document.getElementById("subDistrictId").value;

		if (buildingId == 0) {
			alert("请输入楼栋编号！");
			return false;
		}
		if (name == 0) {
			alert("请输入楼栋名称！");
			return false;
		}
		if (type == 0) {
			alert("请输入楼栋类型！");
			return false;
		}
		if (floorCount == 0) {
			alert("请输入楼栋层数！");
			return false;
		}
		if (subDistrictId == 0) {
			alert("请输入所属管理区！");
			return false;
		}
	}
</script>
<html:form action="building.do?method=updateSave" method="post" onsubmit="return checkForm();">
  <table class="tableline" cellspacing="1" cellpadding="0" width="100%" border="0">
  <html:hidden property="id" value="${building.id}" />
    <tr>
      <td class="STYLE4" colspan="2" height="30" align="center" bgcolor="#ffffff">修改楼栋信息</td>
    </tr>
    <tr>
      <td width="230" height="26" align="right" bgcolor="#ffffff">楼栋编号:</td>
      <td bgcolor="#ffffff">&nbsp;<html:text property="buildingId" value="${building.buildingId }" />
							<font color="red">${buildingIdError }${buildingIdRequest }</font></td>
    </tr>
    <tr>
      <td height="26" align="right" bgcolor="#ffffff">楼栋名称:</td>
      <td bgcolor="#ffffff">&nbsp;<html:text property="name" value="${building.name }" />
							<font color="red">${buildingNameError }</font>
      </td>
    </tr>
    
    <tr>
      <td height="26" align="right" bgcolor="#ffffff">楼栋类型:</td>
      <td bgcolor="#ffffff">
      &nbsp;<html:select property="typeId" style="width:155px;">
				<c:if test="${!empty buildingTypesList}">
					<c:forEach items="${buildingTypesList}" var="buildingType">
						<html:option value="${buildingType.id}">${buildingType.name}</html:option>
					</c:forEach>
				</c:if>
			</html:select>
			<font color="red">${buildingTypeError }</font>
			
	  </td> 
    </tr>
    
    <tr>
      <td height="26" align="right" bgcolor="#ffffff">楼栋层数:</td>
      <td bgcolor="#ffffff">&nbsp;<html:text property="floorCount" value="${building.floorCount }" />
							<font color="red">${buildingFloorCountError }</font>
      </td>
    </tr>
    <tr>
      <td height="26" align="right" bgcolor="#ffffff">所属小区:</td>
      <td bgcolor="#ffffff">
      &nbsp;<html:select property="subDistrictId" style="width:155px;">
				<c:if test="${!empty subDistrictList}">
					<c:forEach items="${subDistrictList}" var="subDistrict">
					<html:option value="${subDistrict.id}">${subDistrict.name}</html:option>
					</c:forEach>
				</c:if>
				</html:select>&nbsp;&nbsp;
				<html:submit value="确认修改" />&nbsp;&nbsp;&nbsp;<html:reset value="取 消" />
				<font color="red">${districtIdError }</font>
      </td>
    </tr>
  </table>
  </html:form>
